var currentTestName;
var currentTestId;
var testId;
$(document).ready($(function() {
	var box = $('#loginBox');
	var form = $('#loginForm');
	form.mouseup(function() {
		return false;
	});
	$(this).mouseup(function(loginBox) {
		if (($(loginBox.target).parent('#loginButton').length > 0)) {
			box.show();
		}
		if (!($(loginBox.target).parent('#loginButton').length > 0)) {
			box.hide();
		}
	});
}));



function showInfoTest(tName, tDescription, id){
	currentTestName = tName;
	testId=id;
	document.getElementById("labelTName").innerHTML = tName;
	document.getElementById("labelTDesc").innerHTML = tDescription;
	$('#testsList').hide();
	$('#testInfo').show();
	
/*	$.ajax({
		type : "POST",
		url : "testq",
		data : "testId=" + id,
	});*/
	
	
};


function take() {
	window.location.href='testq'+'?' + 'testId=' + testId;
}

//function getTestId() {
//	alert(testId);
//	document.getElementById("testIdid").innerHTML = testId;
//}


function showTakeTest(){
		
		document.getElementById("tName").innerHTML = currentTestName;
		/*$('#takeTest').show();*/
		
	};

function changeDate(i) {
	var e = document.getElementById('day');
	y = 2005;
	while (e.length > 0)
		e.remove(e.length - 1);
	var j = -1;
	if (i == "na")
		k = 0;
	else if (i == 2)
		k = 28;
	else if ((y%4)==0)
		k=29;
	else if (i == 4 || i == 6 || i == 9 || i == 11)
		k = 30;
	else
		k = 31;
	while (j++ < k) {
		var s = document.createElement('option');
		var e = document.getElementById('day');
		if (j == 0) {
			s.text = "Day";
			s.value = "na";
			try {
				e.add(s, null);
			} catch (ex) {
				e.add(s);
			}
		} else {
			s.text = j;
			s.value = j;
			try {
				e.add(s, null);
			} catch (ex) {
				e.add(s);
			}
		}
	}
}


function log() {
	var box = $('#loginBox');
	var login = $('#userLogin').val();
	var password = $('#userPassword').val();
	params = {
		userLogin : login,
		userPassword : password
	};
	$.ajax({
		type : "POST",
		url : "login",
		data : params,
		success : function(result) {
			if (result.length > 2) {
				$(".loginStatus").html(result);
			} else {
				box.hide();
				location.reload();
			}
		}
	});
};


window.onload = function(){                                                      
	alert("asd");
};


